package com.hejia.alauda.entity;

import java.math.BigDecimal;

import javax.persistence.Column;

/**
 * 资金变动 Created by Johnny(johnny@hejiajinrong.com) on 14-9-4.
 */
public class BalanceOperation extends BaseEntity {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8111912036089363602L;

	@Column
	private Balance balance;// 对应的用户资金帐户

	@Column
	private BigDecimal amount;// 对应的变动资金量 正数是增加 复数是减少

	@Column
	private Type type;// 变动类型

	public Balance getBalance() {
		return balance;
	}

	public void setBalance(Balance balance) {
		this.balance = balance;
	}

	public BigDecimal getAmount() {
		return amount;
	}

	public void setAmount(BigDecimal amount) {
		this.amount = amount;
	}

	public Type getType() {
		return type;
	}

	public void setType(Type type) {
		this.type = type;
	}

	public String getTypeStr() {
		String str = "未知来源";
		switch (getType()) {
		case RED_ENVELOPE:
			str = "注册红包";
			break;
		case CASH:
			str = "利息领取";
			break;
		case PAYMENT:
			str = "提现";
			break;
		default:
			break;
		}
		return str;
	}

	public enum Type {
		CASH, // 活动虚拟利息兑付 -- 增加
		BUY, // 买入 -- 增加
		PAYMENT, // 回款 -- 支出
		RED_ENVELOPE;// 获得红包 -- 增加
	}
}
